package sim;

public class ContiniousTimeCounter {

	// private long
	private long serverUtilization;
	private long queueOccupancy;

	private long x_last;

	private long t_start;
	private long t_last;
	private long t_stop;
	private long t_i;
	private long x_i;

	public ContiniousTimeCounter() {
		x_i = 0;
		x_last = 0;
		t_start = 0;
		t_last = 0;
		t_i = 0;
		serverUtilization = 0;
	}

	public void graspCustomer(Customer c) {
		long serviceTime = c.getServiceCompletionTime() - c.getServiceInitiationTime();
		x_i = serviceTime;
		t_i = c.getServiceCompletionTime();
		serverUtilization += x_last * (t_i - t_last);
		t_last = t_i;
		x_last = x_i;

		System.out.println("servUtil -> " + serverUtilization);
	}
	

	public void report(long time) {
		t_stop = time;
		serverUtilization = x_last * (t_stop - t_start);
		 System.out.println("Erwartungswert: " + "Arrival Time: " + serverUtilization / (t_stop - t_start) + "\n"
				 );
	}

}
